# Contributor: Zach DeCook <zachdecook@librem.one>
maintainer="Zach DeCook <zachdecook@librem.one>"
pkgname=xcb-util-errors
pkgver=1.0.1
pkgrel=0
_m4_gitrev="c617eee22ae5c285e79e81ec39ce96862fd3262f"
pkgdesc="XCB utility library that gives human readable names to error, event, & request codes"
url="https://gitlab.freedesktop.org/xorg/lib/libxcb-errors"
arch="all"
license="X11-distribute-modifications-variant"
source="
	https://gitlab.freedesktop.org/xorg/lib/libxcb-errors/-/archive/xcb-util-errors-$pkgver/libxcb-errors-xcb-util-errors-$pkgver.tar.gz
	https://gitlab.freedesktop.org/xorg/util/xcb-util-m4/-/archive/$_m4_gitrev/xcb-util-m4-$_m4_gitrev.tar.gz

	fixtest.patch
"
makedepends="autoconf automake libtool libxcb-dev m4 util-macros xorgproto"
subpackages="$pkgname-dev $pkgname-doc"
builddir="$srcdir/libxcb-errors-xcb-util-errors-$pkgver"
options="!check" # Check fails in CI

prepare() {
	default_prepare
	rmdir "$builddir"/m4
	mv "$srcdir"/xcb-util-m4-"$_m4_gitrev" "$builddir"/m4
	libtoolize
	aclocal
	autoconf
	automake --add-missing
}

build() {
	./configure --prefix=/usr
	make
}

check() {
	make tests/test
	tests/test
}

package() {
	make -j1 DESTDIR="$pkgdir" install
	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}
sha512sums="
17dca51af889c17bd23255ccd5e24b8638df62f0b248463a29208f37e65f7a5654e14e8bcfc44b408a69a8caae1c06705ecb05a9f5331432c551faaa26150101  libxcb-errors-xcb-util-errors-1.0.1.tar.gz
d2d977574a106ca59207988e3e4ec12ecbcf30852df46456f7ec5284983e49f31ee85025f404d863f8e3d766f193e6a79508f26a3dcd33173d7bbefccdb279fa  xcb-util-m4-c617eee22ae5c285e79e81ec39ce96862fd3262f.tar.gz
ead96741fecd0f169f51e984af385e2740e185693624b112641ba4b6e054519215ed496e9bafa41b49eef691337f10825fc7122041c674225538ef46832644ef  fixtest.patch
"
